Produced by Araxis Merge on 2023-07-12 04:43:09 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v4.0.5/Theme Files/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/view | layer.js | 2021-02-14 02:06:18 +0000 |
| 2 | Porto v4.0.6/Theme Files/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/view | layer.js | 2023-07-02 08:53:29 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 9 | 778 |
| Changed | 4 | 11 |
| Inserted | 0 | 0 |
| Removed | 4 | 4 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /** | 1 | /** | |||
| 2 | * Mageplaza | 2 | * Mageplaza | |||
| 3 | * | 3 | * | |||
| 4 | * NOTICE OF LICENSE | 4 | * NOTICE OF LICENSE | |||
| 5 | * | 5 | * | |||
| 6 | * This source file is subject to the Mageplaza.com license that is | 6 | * This source file is subject to the Mageplaza.com license that is | |||
| 7 | * available through the world-wide-web at this URL: | 7 | * available through the world-wide-web at this URL: | |||
| 8 | * https://www.mageplaza.com/LICENSE.txt | 8 | * https://www.mageplaza.com/LICENSE.txt | |||
| 9 | * | 9 | * | |||
| 10 | * DISCLAIMER | 10 | * DISCLAIMER | |||
| 11 | * | 11 | * | |||
| 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 13 | * version in the future. | 13 | * version in the future. | |||
| 14 | * | 14 | * | |||
| 15 | * @category Mageplaza | 15 | * @category Mageplaza | |||
| 16 | * @package Mageplaza_AjaxLayer | 16 | * @package Mageplaza_AjaxLayer | |||
| 17 | * @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/) | 17 | * @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/) | |||
| 18 | * @license https://www.mageplaza.com/LICENSE.txt | 18 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 19 | */ | 19 | */ | |||
| 20 | 20 | |||||
| 21 | define([ | 21 | define([ | |||
| 22 | 'jquery', | 22 | 'jquery', | |||
| 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | |||
| 24 | 'Magento_Catalog/js/price-utils', | 24 | 'Magento_Catalog/js/price-utils', | |||
| 25 | 'jquery-ui-modules/widget', | |||||
| 25 | 'accordion', | 26 | 'accordion', | |||
| 26 | 'productListToolbarForm' | 27 | 'productListToolbarForm' | |||
| 27 | ], function ($, submitFilterAction, ultil) { | 28 | ], function ($, submitFilterAction, ultil) { | |||
| 28 | "use strict"; | 29 | "use strict"; | |||
| 29 | var next_page = ""; | 30 | ||||
| 30 | var loading = false; | |||||
| 31 | var infinite_loaded_count = 0; | 31 | var infinite_loaded_count = 0; | |||
| 32 | var active = false; | |||||
| 33 | 32 | |||||
| 34 | $.widget('mageplaza.layer', $.mage.accordion, { | 33 | $.widget('mageplaza.layer', $.mage.accordion, { | |||
| 35 | options: { | 34 | options: { | |||
| 36 | openedState: 'active', | 35 | openedState: 'active', | |||
| 37 | collapsible: true, | 36 | collapsible: true, | |||
| 38 | multipleCollapsible: true, | 37 | multipleCollapsible: true, | |||
| 39 | animate: 200, | 38 | animate: 200, | |||
| 40 | productsListSelector: '#layer-product-list', | 39 | productsListSelector: '#layer-product-list', | |||
| 41 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | 40 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | |||
| 42 | collapsibleElement: '[data-role=ln_collapsible]', | 41 | collapsibleElement: '[data-role=ln_collapsible]', | |||
| 43 | header: '[data-role=ln_title]', | 42 | header: '[data-role=ln_title]', | |||
| 44 | content: '[data-role=ln_content]', | 43 | content: '[data-role=ln_content]', | |||
| 45 | isCustomerLoggedIn: false, | 44 | isCustomerLoggedIn: false, | |||
| 46 | params: [], | 45 | params: [], | |||
| 47 | active: [] | 46 | active: [] | |||
| 48 | }, | 47 | }, | |||
| 49 | 48 | |||||
| 50 | inFinite: function() { | 49 | inFinite: function() { | |||
| 51 | var self = this; | 50 | var self = this; | |||
| 52 | next_page = ""; | 51 | next_page = ""; | |||
| 53 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | 52 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||
| 54 | active = true; | 53 | active = true; | |||
| 55 | } | 54 | } | |||
| 56 | $(".pages-items li > a.next").each(function(){ | 55 | $(".pages-items li > a.next").each(function(){ | |||
| 57 | next_page = $(this).attr("href"); | 56 | next_page = $(this).attr("href"); | |||
| 58 | }); | 57 | }); | |||
| 59 | if(!next_page){ | 58 | if(!next_page){ | |||
| 60 | $('.infinite-loader').hide(); | 59 | $('.infinite-loader').hide(); | |||
| 61 | } | 60 | } | |||
| 62 | $(".infinite-loader .btn-load-more").click(function(){ | 61 | $(".infinite-loader .btn-load-more").click(function(){ | |||
| 63 | if(!loading && next_page){ | 62 | if(!loading && next_page){ | |||
| 64 | loading = true; | 63 | loading = true; | |||
| 65 | self.ajaxInfinite(next_page); | 64 | self.ajaxInfinite(next_page); | |||
| 66 | } | 65 | } | |||
| 67 | }); | 66 | }); | |||
| 68 | }, | 67 | }, | |||
| 69 | 68 | |||||
| 70 | ajaxInfinite: function (submitUrl) { | 69 | ajaxInfinite: function (submitUrl) { | |||
| 71 | var self = this; | 70 | var self = this; | |||
| 72 | infinite_loaded_count++; | 71 | infinite_loaded_count++; | |||
| 73 | $('.infinite-loader .btn-load-more').hide(); | 72 | $('.infinite-loader .btn-load-more').hide(); | |||
| 74 | $('.infinite-loader .loading').show(); | 73 | $('.infinite-loader .loading').show(); | |||
| 75 | $.ajax({ | 74 | $.ajax({ | |||
| 76 | url: submitUrl, | 75 | url: submitUrl, | |||
| 77 | type: 'get', | 76 | type: 'get', | |||
| 78 | beforeSend: function () { | 77 | beforeSend: function () { | |||
| 79 | $('.infinite-loader .btn-load-more').hide(); | 78 | $('.infinite-loader .btn-load-more').hide(); | |||
| 80 | $('.infinite-loader .loading').show(); | 79 | $('.infinite-loader .loading').show(); | |||
| 81 | }, | 80 | }, | |||
| 82 | success: function (res) { | 81 | success: function (res) { | |||
| 83 | loading = false; | 82 | loading = false; | |||
| 84 | var $products = $(res.products); | 83 | var $products = $(res.products); | |||
| 85 | if (res.backUrl) { | 84 | if (res.backUrl) { | |||
| 86 | window.location = res.backUrl; | 85 | window.location = res.backUrl; | |||
| 87 | return; | 86 | return; | |||
| 88 | } | 87 | } | |||
| 89 | if($products){ | 88 | if($products){ | |||
| 90 | $products.each(function(i,el){ | 89 | $products.each(function(i,el){ | |||
| 91 | if($(el).hasClass('products-grid')){ | 90 | if($(el).hasClass('products-grid')){ | |||
| 92 | var items_grid = $(this).find('.product-items .item'); | 91 | var items_grid = $(this).find('.product-items .item'); | |||
| 93 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | 92 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||
| 94 | $(self.options.productsListSelector).trigger('contentUpdated'); | 93 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 95 | } | 94 | } | |||
| 96 | if($(el).hasClass('products-list')){ | 95 | if($(el).hasClass('products-list')){ | |||
| 97 | var items_list = $(this).find('.product-items .item'); | 96 | var items_list = $(this).find('.product-items .item'); | |||
| 98 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | 97 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||
| 99 | $(self.options.productsListSelector).trigger('contentUpdated'); | 98 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 100 | } | 99 | } | |||
| 101 | if($(el).hasClass('toolbar-products')){ | 100 | if($(el).hasClass('toolbar-products')){ | |||
| 102 | if($(this).find('.pages a.next').length > 0){ | 101 | if($(this).find('.pages a.next').length > 0){ | |||
| 103 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | 102 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | |||
| 104 | }else{ | 103 | }else{ | |||
| 105 | $(self.options.productsListSelector + ' .pages a.next').remove(); | 104 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||
| 106 | } | 105 | } | |||
| 107 | } | 106 | } | |||
| 108 | }); | 107 | }); | |||
| 109 | if($("form[data-role=tocart-form]").length > 0) { | 108 | if($("form[data-role=tocart-form]").length > 0) { | |||
| 110 | $("form[data-role=tocart-form]").catalogAddToCart(); | 109 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||
| 111 | } | 110 | } | |||
| 112 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | 111 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | |||
| 113 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | 112 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | |||
| 114 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | 113 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | |||
| 115 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | 114 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | |||
| 116 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | 115 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | |||
| 117 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | 116 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | |||
| 118 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | 117 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | |||
| 119 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | 118 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | |||
| 120 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | 119 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | |||
| 121 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | 120 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | |||
| 122 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | 121 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | |||
| 123 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | 122 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | |||
| 124 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | 123 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | |||
| 125 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | 124 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | |||
| 126 | var hist = submitUrl; | 125 | var hist = submitUrl; | |||
| 127 | if(submitUrl.indexOf("p=") > -1){ | 126 | if(submitUrl.indexOf("p=") > -1){ | |||
| 128 | var len = submitUrl.length-submitUrl.indexOf("p="); | 127 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||
| 129 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | 128 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||
| 130 | var page_param = ""; | 129 | var page_param = ""; | |||
| 131 | if(str_temp.indexOf("&") == -1){ | 130 | if(str_temp.indexOf("&") == -1){ | |||
| 132 | page_param = str_temp; | 131 | page_param = str_temp; | |||
| 133 | } else { | 132 | } else { | |||
| 134 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | 133 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||
| 135 | } | 134 | } | |||
| 136 | hist = submitUrl.replace(page_param, ""); | 135 | hist = submitUrl.replace(page_param, ""); | |||
| 137 | } | 136 | } | |||
| 138 | if (typeof window.history.pushState === 'function') { | 137 | if (typeof window.history.pushState === 'function') { | |||
| 139 | window.history.pushState({url: hist}, '', hist); | 138 | window.history.pushState({url: hist}, '', hist); | |||
| 140 | } | 139 | } | |||
| 141 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 140 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 142 | requirejs(['jquery', 'weltpixel_quickview' ], | 141 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 143 | function($, quickview) { | 142 | function($, quickview) { | |||
| 144 | $('.weltpixel-quickview').off('click').on('click', function() { | 143 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 145 | var prodUrl = $(this).attr('data-quickview-url'); | 144 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 146 | if (prodUrl.length) { | 145 | if (prodUrl.length) { | |||
| 147 | quickview.displayContent(prodUrl); | 146 | quickview.displayContent(prodUrl); | |||
| 148 | } | 147 | } | |||
| 149 | }); | 148 | }); | |||
| 150 | }); | 149 | }); | |||
| 151 | } | 150 | } | |||
| 152 | $(".products-grid .weltpixel-quickview").each(function(){ | 151 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 153 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 152 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 154 | }); | 153 | }); | |||
| 155 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 154 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 156 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 155 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 157 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | 156 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | |||
| 158 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 157 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 159 | }); | 158 | }); | |||
| 160 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 159 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 161 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 160 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 162 | }); | 161 | }); | |||
| 163 | } | 162 | } | |||
| 164 | next_page = ""; | 163 | next_page = ""; | |||
| 165 | $(".pages-items li > a.next").each(function(){ | 164 | $(".pages-items li > a.next").each(function(){ | |||
| 166 | next_page = $(this).attr("href"); | 165 | next_page = $(this).attr("href"); | |||
| 167 | }); | 166 | }); | |||
| 168 | $('.infinite-loader .loading').hide(); | 167 | $('.infinite-loader .loading').hide(); | |||
| 169 | if(next_page){ | 168 | if(next_page){ | |||
| 170 | $('.infinite-loader .btn-load-more').show(); | 169 | $('.infinite-loader .btn-load-more').show(); | |||
| 171 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | 170 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||
| 172 | if(!loading && next_page){ | 171 | if(!loading && next_page){ | |||
| 173 | loading = true; | 172 | loading = true; | |||
| 174 | self.ajaxInfinite(next_page); | 173 | self.ajaxInfinite(next_page); | |||
| 175 | } | 174 | } | |||
| 176 | }); | 175 | }); | |||
| 177 | } | 176 | } | |||
| 178 | } | 177 | } | |||
| 179 | 178 | |||||
| 180 | }, | 179 | }, | |||
| 181 | error: function () { | 180 | error: function () { | |||
| 182 | window.location.reload(); | 181 | window.location.reload(); | |||
| 183 | } | 182 | } | |||
| 184 | }); | 183 | }); | |||
| 185 | }, | |||||
| 186 | 184 | |||||
| 187 | _create: function () { | 185 | _create: function () { | |||
| 188 | this.initActiveItems(); | 186 | this.initActiveItems(); | |||
| 189 | 187 | |||||
| 190 | this._super(); | 188 | this._super(); | |||
| 191 | 189 | |||||
| 192 | this.initProductListUrl(); | 190 | this.initProductListUrl(); | |||
| 193 | this.initObserve(); | 191 | this.initObserve(); | |||
| 194 | this.initWishlistCompare(); | 192 | this.initWishlistCompare(); | |||
| 195 | }, | 193 | }, | |||
| 196 | 194 | |||||
| 197 | initActiveItems: function () { | 195 | initActiveItems: function () { | |||
| 198 | var layerActives = this.options.active, | 196 | var layerActives = this.options.active, | |||
| 199 | actives = []; | 197 | actives = []; | |||
| 200 | 198 | |||||
| 201 | if (typeof window.layerActiveTabs !== 'undefined') { | 199 | if (typeof window.layerActiveTabs !== 'undefined') { | |||
| 202 | layerActives = window.layerActiveTabs; | 200 | layerActives = window.layerActiveTabs; | |||
| 203 | } | 201 | } | |||
| 204 | if (layerActives.length) { | 202 | if (layerActives.length) { | |||
| 205 | this.element.find('.filter-options-item').each(function (index) { | 203 | this.element.find('.filter-options-item').each(function (index) { | |||
| 206 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | 204 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | |||
| 207 | actives.push(index); | 205 | actives.push(index); | |||
| 208 | } | 206 | } | |||
| 209 | }); | 207 | }); | |||
| 210 | } | 208 | } | |||
| 211 | 209 | |||||
| 212 | this.options.active = actives; | 210 | this.options.active = actives; | |||
| 213 | 211 | |||||
| 214 | return this; | 212 | return this; | |||
| 215 | }, | 213 | }, | |||
| 216 | 214 | |||||
| 217 | initProductListUrl: function () { | 215 | initProductListUrl: function () { | |||
| 218 | var isProcessToolbar = false; | 216 | var isProcessToolbar = false; | |||
| 219 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 217 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 220 | if (isProcessToolbar) { | 218 | if (isProcessToolbar) { | |||
| 221 | return; | 219 | return; | |||
| 222 | } | 220 | } | |||
| 223 | isProcessToolbar = true; | 221 | isProcessToolbar = true; | |||
| 224 | 222 | |||||
| 225 | var urlPaths = this.options.url.split('?'), | 223 | var urlPaths = this.options.url.split('?'), | |||
| 226 | baseUrl = urlPaths[0], | 224 | baseUrl = urlPaths[0], | |||
| 227 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 225 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 228 | paramData = {}, | 226 | paramData = {}, | |||
| 229 | parameters; | 227 | parameters; | |||
| 230 | for (var i = 0; i < urlParams.length; i++) { | 228 | for (var i = 0; i < urlParams.length; i++) { | |||
| 231 | parameters = urlParams[i].split('='); | 229 | parameters = urlParams[i].split('='); | |||
| 232 | paramData[parameters[0]] = parameters[1] !== undefined | 230 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 233 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 231 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 234 | : ''; | 232 | : ''; | |||
| 235 | } | 233 | } | |||
| 236 | paramData[paramName] = paramValue; | 234 | paramData[paramName] = paramValue; | |||
| 237 | if (paramValue === defaultValue) { | 235 | if (paramValue === defaultValue) { | |||
| 238 | delete paramData[paramName]; | 236 | delete paramData[paramName]; | |||
| 239 | } | 237 | } | |||
| 240 | paramData = $.param(paramData); | 238 | paramData = $.param(paramData); | |||
| 241 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | 239 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 242 | } | 240 | } | |||
| 243 | }, | 241 | }, | |||
| 244 | 242 | |||||
| 245 | initObserve: function () { | 243 | initObserve: function () { | |||
| 246 | var self = this; | 244 | var self = this; | |||
| 247 | infinite_loaded_count = 0; | |||||
| 248 | 245 | |||||
| 249 | // fix browser back, forward button | 246 | // fix browser back, forward button | |||
| 250 | if (typeof window.history.replaceState === "function") { | 247 | if (typeof window.history.replaceState === "function") { | |||
| 251 | window.history.replaceState({url: document.URL}, document.title); | 248 | window.history.replaceState({url: document.URL}, document.title); | |||
| 252 | 249 | |||||
| 253 | setTimeout(function () { | 250 | setTimeout(function () { | |||
| 254 | window.onpopstate = function (e) { | 251 | window.onpopstate = function (e) { | |||
| 255 | if (e.state) { | 252 | if (e.state) { | |||
| 256 | submitFilterAction(e.state.url, 1); | 253 | submitFilterAction(e.state.url, 1); | |||
| 257 | } | 254 | } | |||
| 258 | }; | 255 | }; | |||
| 259 | }, 0) | 256 | }, 0) | |||
| 260 | } | 257 | } | |||
| 261 | 258 | |||||
| 262 | var pageElements = $('#layer-product-list').find('.pages a'); | 259 | var pageElements = $('#layer-product-list').find('.pages a'); | |||
| 263 | pageElements.each(function () { | 260 | pageElements.each(function () { | |||
| 264 | var el = $(this), | 261 | var el = $(this), | |||
| 265 | link = self.checkUrl(el.prop('href')); | 262 | link = self.checkUrl(el.prop('href')); | |||
| 266 | if (!link) { | 263 | if (!link) { | |||
| 267 | return; | 264 | return; | |||
| 268 | } | 265 | } | |||
| 269 | 266 | |||||
| 270 | el.bind('click', function (e) { | 267 | el.bind('click', function (e) { | |||
| 271 | submitFilterAction(link); | 268 | submitFilterAction(link); | |||
| 272 | e.stopPropagation(); | 269 | e.stopPropagation(); | |||
| 273 | e.preventDefault(); | 270 | e.preventDefault(); | |||
| 274 | }) | 271 | }) | |||
| 275 | }); | 272 | }); | |||
| 276 | 273 | |||||
| 277 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | 274 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | |||
| 278 | currentElements.each(function (index) { | 275 | currentElements.each(function (index) { | |||
| 279 | var el = $(this), | 276 | var el = $(this), | |||
| 280 | link = self.checkUrl(el.prop('href')); | 277 | link = self.checkUrl(el.prop('href')); | |||
| 281 | if (!link) { | 278 | if (!link) { | |||
| 282 | return; | 279 | return; | |||
| 283 | } | 280 | } | |||
| 284 | 281 | |||||
| 285 | el.bind('click', function (e) { | 282 | el.bind('click', function (e) { | |||
| 286 | submitFilterAction(link); | 283 | submitFilterAction(link); | |||
| 287 | e.stopPropagation(); | 284 | e.stopPropagation(); | |||
| 288 | e.preventDefault(); | 285 | e.preventDefault(); | |||
| 289 | }); | 286 | }); | |||
| 290 | }); | 287 | }); | |||
| 291 | 288 | |||||
| 292 | var optionElements = this.element.find('.filter-options a'); | 289 | var optionElements = this.element.find('.filter-options a'); | |||
| 293 | optionElements.each(function (index) { | 290 | optionElements.each(function (index) { | |||
| 294 | var el = $(this), | 291 | var el = $(this), | |||
| 295 | link = self.checkUrl(el.prop('href')); | 292 | link = self.checkUrl(el.prop('href')); | |||
| 296 | if (!link) { | 293 | if (!link) { | |||
| 297 | return; | 294 | return; | |||
| 298 | } | 295 | } | |||
| 299 | 296 | |||||
| 300 | el.bind('click', function (e) { | 297 | el.bind('click', function (e) { | |||
| 301 | if (el.hasClass('swatch-option-link-layered')) { | 298 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 302 | self.selectSwatchOption(el); | 299 | self.selectSwatchOption(el); | |||
| 303 | } | 300 | } | |||
| 304 | 301 | |||||
| 305 | self.ajaxSubmit(link); | 302 | self.ajaxSubmit(link); | |||
| 306 | e.stopPropagation(); | 303 | e.stopPropagation(); | |||
| 307 | e.preventDefault(); | 304 | e.preventDefault(); | |||
| 308 | }); | 305 | }); | |||
| 309 | }); | 306 | }); | |||
| 310 | 307 | |||||
| 311 | var swatchElements = this.element.find('.swatch-attribute'); | 308 | var swatchElements = this.element.find('.swatch-attribute'); | |||
| 312 | swatchElements.each(function (index) { | 309 | swatchElements.each(function (index) { | |||
| 313 | var el = $(this); | 310 | var el = $(this); | |||
| 314 | var attCode = el.attr('attribute-code'); | 311 | var attCode = el.attr('attribute-code'); | |||
| 315 | if (attCode) { | 312 | if (attCode) { | |||
| 316 | if (self.options.params.hasOwnProperty(attCode)) { | 313 | if (self.options.params.hasOwnProperty(attCode)) { | |||
| 317 | var attValues = self.options.params[attCode].split(","); | 314 | var attValues = self.options.params[attCode].split(","); | |||
| 318 | var swatchOptions = el.find('.swatch-option'); | 315 | var swatchOptions = el.find('.swatch-option'); | |||
| 319 | swatchOptions.each(function (option) { | 316 | swatchOptions.each(function (option) { | |||
| 320 | var elOption = $(this); | 317 | var elOption = $(this); | |||
| 321 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | 318 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | |||
| 322 | elOption.addClass('selected'); | 319 | elOption.addClass('selected'); | |||
| 323 | } | 320 | } | |||
| 324 | }); | 321 | }); | |||
| 325 | } | 322 | } | |||
| 326 | } | 323 | } | |||
| 327 | }); | 324 | }); | |||
| 328 | ||||||
| 329 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 325 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 330 | requirejs(['jquery', 'weltpixel_quickview' ], | 326 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 331 | function($, quickview) { | 327 | function($, quickview) { | |||
| 332 | $('.weltpixel-quickview').off('click').on('click', function() { | 328 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 333 | var prodUrl = $(this).attr('data-quickview-url'); | 329 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 334 | if (prodUrl.length) { | 330 | if (prodUrl.length) { | |||
| 335 | quickview.displayContent(prodUrl); | 331 | quickview.displayContent(prodUrl); | |||
| 336 | } | 332 | } | |||
| 337 | }); | 333 | }); | |||
| 338 | }); | 334 | }); | |||
| 339 | } | 335 | } | |||
| 340 | 336 | |||||
| 341 | $(".products-grid .weltpixel-quickview").each(function(){ | 337 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 342 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | 338 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | |||
| 343 | }); | 339 | }); | |||
| 344 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 340 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 345 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 341 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 346 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 342 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 347 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 343 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 348 | }); | 344 | }); | |||
| 349 | } | 345 | } | |||
| 350 | self.inFinite(); | 346 | self.inFinite(); | |||
| 351 | }, | 347 | }, | |||
| 352 | 348 | |||||
| 353 | selectSwatchOption: function (el) { | 349 | selectSwatchOption: function (el) { | |||
| 354 | var childEl = el.find('.swatch-option'); | 350 | var childEl = el.find('.swatch-option'); | |||
| 355 | if (childEl.hasClass('selected')) { | 351 | if (childEl.hasClass('selected')) { | |||
| 356 | childEl.removeClass('selected'); | 352 | childEl.removeClass('selected'); | |||
| 357 | } else { | 353 | } else { | |||
| 358 | childEl.addClass('selected'); | 354 | childEl.addClass('selected'); | |||
| 359 | } | 355 | } | |||
| 360 | }, | 356 | }, | |||
| 361 | 357 | |||||
| 362 | ajaxSubmit: function (submitUrl) { | 358 | ajaxSubmit: function (submitUrl) { | |||
| 363 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | 359 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | |||
| 364 | 360 | |||||
| 365 | return submitFilterAction(submitUrl); | 361 | return submitFilterAction(submitUrl); | |||
| 366 | }, | 362 | }, | |||
| 367 | 363 | |||||
| 368 | checkUrl: function (url) { | 364 | checkUrl: function (url) { | |||
| 369 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 365 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 370 | 366 | |||||
| 371 | return regex.test(url) ? url : null; | 367 | return regex.test(url) ? url : null; | |||
| 372 | }, | 368 | }, | |||
| 373 | 369 | |||||
| 374 | //Handling 'add to wishlist' & 'add to compare' event | 370 | //Handling 'add to wishlist' & 'add to compare' event | |||
| 375 | initWishlistCompare: function () { | 371 | initWishlistCompare: function () { | |||
| 376 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | 372 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | |||
| 377 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | 373 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | |||
| 378 | $(elClass).each(function () { | 374 | $(elClass).each(function () { | |||
| 379 | var el = $(this); | 375 | var el = $(this); | |||
| 380 | $(el).bind('click', function (e) { | 376 | $(el).bind('click', function (e) { | |||
| 381 | var dataPost = $(el).data('post'), | 377 | var dataPost = $(el).data('post'), | |||
| 382 | formKey = $('input[name="form_key"]').val() | 378 | formKey = $('input[name="form_key"]').val(), method = 'post'; | |||
| 383 | if (formKey) { | 379 | if (formKey) { | |||
| 384 | dataPost.data.form_key = formKey; | 380 | dataPost.data.form_key = formKey; | |||
| 385 | } | 381 | } | |||
| 386 | 382 | |||||
| 387 | var paramData = $.param(dataPost.data), | 383 | var paramData = $.param(dataPost.data), | |||
| 388 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | 384 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | |||
| 389 | 385 | submitFilterAction(url, true, method); | ||||
| 390 | submitFilterAction(url, true | |||||
| 391 | e.stopPropagation(); | 386 | e.stopPropagation(); | |||
| 392 | e.preventDefault(); | 387 | e.preventDefault(); | |||
| 393 | }); | 388 | }); | |||
| 394 | }) | 389 | }) | |||
| 395 | } | 390 | } | |||
| 396 | }); | 391 | }); | |||
| 397 | 392 | |||||
| 398 | return $.mageplaza.layer; | 393 | return $.mageplaza.layer; | |||
| 399 | }); | 394 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.